from pyb import Timer, Pin, UART


uart = UART(2, 9600)


def send_text(text):
    uart.write(text)


def receive_text(BLE):
    while 1 :
        if BLE.uart.any():  # 查询是否有信息
            text = BLE.uart.read(1)  # 默认单次最多接收128字节
            if text.find( b'o')>-1:
                return 3
            elif text.find(b'a')>-1:
                return 1
        if uart.any():
            text = uart.read(1)
            uart.write(text)
            print(text)
            return (text)

